from django.db import models

from sportsground.utils.baseModels import BaseModels


class Venue(BaseModels):
    class Meta():
        db_table = 'venue'
        verbose_name = '馆场'
        verbose_name_plural = verbose_name

    name = models.CharField(max_length=20, null=True, verbose_name="名称")
    notice = models.CharField(max_length=200, default='', verbose_name="公告")

    @classmethod
    def create(cls, name=None):
        """ 创建馆场 """
        venue = cls(name=name)
        venue.save()
        return venue

    def Info(self):
        return {
            "id": self.id,
            "name": self.name,
            "notice": self.notice,
        }
